package com.hy.mydesktop.shared.persistence.domain.gxt;

import java.io.Serializable;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import net.sf.gilead.annotations.ServerOnly;
import net.sf.gilead.pojo.gwt.LightEntity;


import com.extjs.gxt.ui.client.data.BaseModel;
import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.rpc.core.org.hibernate.collection.PersistentBag_CustomFieldSerializer;
import com.hy.enterprise.framework.util.lang.UUIDUtil;
import com.hy.mydesktop.shared.persistence.domain.gxt.constant.MetaDataConstants;
import com.hy.mydesktop.shared.persistence.domain.util.Persistable;
import com.hy.mydesktop.shared.util.log.MyLoggerUtil;

@MappedSuperclass
public class MyBaseModel extends MyGxtBaseModelWithGilead implements IsSerializable, Persistable{
//	public class MyBaseModel extends LightEntity  implements IsSerializable, Persistable{

	/*BaseModel baseModel = null;
	@Transient
	public BaseModel getBaseModel() {
		return baseModel;
	}

	public void setBaseModel(BaseModel baseModel) {
		this.baseModel = baseModel;
	}*/

	

	
	
	

	public MyBaseModel() {
		super();
//		this.setIdentifier(UUIDUtil.randomUUID());
	}

	public MyBaseModel(Map<String, Object> properties) {
		super(properties);
		// TODO Auto-generated constructor stub
	}

	@Id
	@Column(length=36)
	//@Transient
	@Override
	public String getIdentifier() {
		return this.get(MetaDataConstants.IDENTIFIER);

		//return getId();
	}

	//@Id
	//@Column(length=36)
	@Override
	public String getId() {
		return this.get(MetaDataConstants.ID);
	}

	@Override
	public void setIdentifier(String identifier) {
		this.set(MetaDataConstants.IDENTIFIER, identifier);
		
	}

	@Override
	public void setId(String id) {
//		this.set("id", id);
		this.set(MetaDataConstants.ID, id);
	}
	
	/*public  <X> X set(String property, X value) {
		return baseModel.set(property, value);
	}
	@Transient
	public <X> X get(String property) {
  	 // MyLoggerUtil.printError(this.getClass().getName(), "调用get方法,参数property为 "
  	//		  +property+" ,返回值为"+baseModel.get(property,null));

		return baseModel.get(property,null);

	};
	@Transient
	public <X> X get(String property, X valueWhenNull) {
		return baseModel.get(property, valueWhenNull);

	}*/
	

}
